<?php
$db = m('module');
$adminMenu = $db->getAdminMenu();
$C = load::loadClass('router')->c;
$M = load::loadClass('router')->m;
$adminTag = $db->getTag();
?>

<div class="layui-header">
    <div class="layui-logo" style="color:#fff;font-size:25px;"> <a class="" style="color:#FF5722" href="{url }"><i class="layui-icon" style="font-size: 35px; ">&#xe68e;</i>  网站后台</a></div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left" style="display:00none">
	<li class="layui-nav-item {if $_SESSION['user']['tag']=='all'}layui-this{/if}"><a href="{url c='index' m='index' tag='all'}">所有菜单</a></li>
	{foreach $adminTag as $k => $v}
      <li class="layui-nav-item {if $_SESSION['user']['tag']==$k}layui-this{/if}"><a href="{url c='index' m='index' tag=$k}">{$v}</a></li>
	  {/foreach}
      <li class="layui-nav-item" style="display:none">
        <a href="javascript:;">其它系统</a>
        <dl class="layui-nav-child">
          <dd><a href="">邮件管理</a></dd>
          <dd><a href="">消息管理</a></dd>
          <dd><a href="">授权管理</a></dd>
        </dl>
      </li>
    </ul>
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
          {$_SESSION['user']['login']}
        </a>
        <dl class="layui-nav-child">
          <dd><a href="{url c='user' m='myinfo'}">基本资料</a></dd>
		  
          <dd><a href="{url c='user' m='changepassword'}" class="left_menu">密码修改</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="{url c='index' m='logout'}">退出</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        

		{foreach $adminMenu as $k => $v}
		
        <!--模块-->
		<li class="layui-nav-item layui-nav-itemed">
          <a href="javascript:;" class="n"> {$v.name} </a>
          <dl class="layui-nav-child ll-child">
			{foreach $v['op'] as $kk => $vv}
				<?php if(checkAuth($vv['module_id'], $vv['method'])) { ?>
					{if $vv['other'] == ''}
					<dd><a href="{url c=$vv.module_id m=$vv.method}">{:showIcon($vv['tpl'])} {$vv.name}</a></dd>
					{elseif $vv['other'] == 'ajax'}
						<dd><a href="{url c=$vv.module_id m=$vv.method}" class="left_menu">{:showIcon($vv['tpl'])} {$vv.name}</a></dd>
					{/if}
				<?php } ?>
			{/foreach}
          </dl>
        </li>
        <!--/模块-->
		
		{/foreach}

		
		


        <!---<li class="layui-nav-item"><a href="">云市场</a></li>
        <li class="layui-nav-item"><a href="">发布商品</a></li>--->
      </ul>
    </div>
  </div>


  <script>
  layui.use(['layer'], function(){

	  $ = layui.$ ;  
	  $.each($('.left_menu'),function(){		
			$(this).click(function(){
				openPage($(this).attr('href'),$(this).html());

				return false;
			});
		});

		$(function(){
		$('.ll-child').each(function(){
			if($(this).find('dd').html() == undefined){
				$(this).parent().css("display","none");
			}else{
				$(this).parent().css("display","");
			}
		});
	  })
  
  });


  </script>
